<template>
    <div>
      <table>
          <tr>
            <td>商品名称</td>
            <td>价格</td>

          </tr>
          <tr v-for="item in carts">
            <td>{{ item.name }}</td>
            <td>{{ item.price }}</td>

          </tr>
        </table>
    </div>
</template>

<script>
    import axios from "axios";

    export default {
        name: "showcart",
      data(){
          return{
            carts:[]
          }
        },
        mounted() {
          var name = localStorage.getItem('name')
          axios({
            url:'http://127.0.0.1:8000/showcart/',
            method:'post',
            data:{'name':name}
          }).then(res=>{
            this.carts = res.data.data;
            console.log(res)
          })
        },
    }
</script>

<style scoped>

</style>
